package mobi.hami.huapin.util;

import java.util.Calendar;
import java.util.Date;

/**
 * week相关操作
 *
 * @author 阿飞 jijunjian@hami.mobi
 * @date 2018/7/9 22:10
 */
public class Weeks {

    /**
     * 查询 当前时间是一周中的第几天。周1为第1.
     * @return
     */
    public  static  int getDayOfWeek(Date date)
    {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int day_of_week = calendar.get(Calendar.DAY_OF_WEEK);

        day_of_week -=1;

        if (day_of_week == 0)
        {
            day_of_week= 7;
        }

        return  day_of_week;
    }
}
